import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import ImgList from './views/imgs/ImgList.vue'
import Detail from './views/imgs/Detail.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home
    },
    {
      path: '/goodslist',
      name: 'goodslist',
      // route level code-splitting
      // this generates a separate chunk (about.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import(/* webpackChunkName: "about" */ './views/goods/GoodsList.vue')
    },
    {
      path: '/goodsdetail/:id',
      name: 'goodsdetail',
      component: () => import(/* webpackChunkName: "about" */ './views/goods/GoodsDetail.vue')
    },
    {
      path: '/goodsdetail/:id/goodsdesc',
      name: 'goodsdesc',
      component: () => import(/* webpackChunkName: "about" */ './views/goods/GoodsDesc.vue')
    },
    {
      path: '/goodscomment/:id',
      name: 'goodscomment',
      component: () => import(/* webpackChunkName: "about" */ './views/goods/GoodsComment.vue')
    },
    {
      name: 'imglist',
      path: '/imglist',
      component: ImgList
    },
    {
      name: 'detail',
      path: '/detail/:id',
      component: Detail
    },
    // 购物车
    {
      path: '/cart',
      name: 'cart',
      component: () => import('./views/Cart.vue')
    },
    // 新闻列表
    {
      path: '/newslist',
      name: 'newslist',
      component: () => import(/* webpackChunkName: "about" */ './views/news/NewsList.vue')
    },
    // 新闻详情
    {
      path: '/newslistdetail/:id',
      name: 'newslistdetail',
      component: () => import(/* webpackChunkName: "about" */ './views/news/NewsListDetail.vue')
    }
  ]
})
